<?php 
/**
 * TODO: Just draft
 * Date: 2009.02.07
 * http://framework.zend.com/wiki/display/ZFPROP/Zend_View_Helper_IndentLines
 */ 
class Clu_View_Helper_HvnSlideshow extends Zend_View_Helper_Abstract
{ 
    public function HvnSlideshow ($data)
    {
    	$userId = $data['userId'];
    	$contentType = $data['contentType'];
    	$id = $data['contentId'];
    	$size = $data['size'];
    	$dir = APP_PATH."/public/ufiles/$userId/images/$size/$contentType/";
    	if(file_exists($dir))
		{
		    $files = scandir($dir);
		    $displayFiles = array();
		    foreach ($files as $f)
		    {
		    	if (strpos ($f, $id . "_") === 0)
		    	{
		    		$ctime = filectime($dir . $f); 
 		    		$displayFiles[$f] = $ctime;
		    	}
		    }
	    }
    	if (isset($displayFiles) && count($displayFiles) > 0)
    	{
    		asort($displayFiles);
    		$ret = "";
		    foreach ($displayFiles as $thumb => $ctime)
    			$ret .= "<img src='/public/ufiles/$userId/images/$size/$contentType/$thumb' />";
    	}
    	else
    		$ret = "<img src='/public/themes/prime/images/common/75x75_no_image.gif' />";
	    return $ret;
    } 
}
?>